package cn.controller;

import cn.common.ExceResult;
import cn.common.LayTable;
import cn.filter.LoginCheck;
import cn.kpi.entity.attendance.AttDetailEntity;
import cn.kpi.entity.attendance.AttSummaryEntity;
import cn.kpi.entity.attendance.AttTbBatchEntity;
import cn.kpi.entity.sys.UserEntity;
import cn.kpi.service.attendance.IAttTbService;
import cn.kpi.service.common.IOrgSummaryService;
import cn.kpi.service.loan.ILoanUserService;
import cn.kpi.service.sys.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;

@Controller
@EnableScheduling
public class TaskController extends BaseController {

	@Autowired
	private ILoanUserService iLoanUserService;

	//@Scheduled(cron="0 0 9,18 * * ?")//每天上午9和下午6点执行一次定时任务
	@Scheduled(cron="0 0 1 * * ?")//每天1点执行一次定时任务
	public void syncLoanUserSzbm(){
		System.out.println("开始执行定时任务");
		try{
			int result=iLoanUserService.LoanTask();
			System.out.println("执行定时任务结束："+result);
		}
		catch(Exception ex){
			ex.printStackTrace();
			System.out.println("执行定时任务异常 ");
		}

	}
}
